/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */
#ifndef __QS_DiagramEdge_H__
#define __QS_DiagramEdge_H__

#include "Prerequisites.h"

#include <QtGui/QGraphicsItem>

namespace QSThink
{
	class DiagramNode;

	class DiagramEdge
		: public QGraphicsItem
	{

	public:
		DiagramEdge(DiagramNode *sourceNode, DiagramNode *destNode);
		~DiagramEdge();

		DiagramNode* sourceNode() const;
		DiagramNode* destNode() const;

		void setSourceNode(DiagramNode *node);
		void setDestNode(DiagramNode *node);

		void adjust();

		enum { Type = UserType + 2 };
		int type() const { return Type; }

	protected:
		QRectF boundingRect() const;
		//void QGraphicsItem::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 )   [pure virtual]
		void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);



	protected:
		DiagramNode* _source;
		DiagramNode* _dest;

		QPointF _sourcePoint;
		QPointF _destPoint;

		qreal _arrowSize;


	};
	
}
#endif
